<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <title>宜鲜生</title>
    <meta name="renderer" content="webkit">
    <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
    <meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1">
    <meta name="apple-mobile-web-app-status-bar-style" content="black">
    <meta name="apple-mobile-web-app-capable" content="yes">
    <meta name="format-detection" content="telephone=no">
    <!-- load css -->
    <link rel="stylesheet" type="text/css" href="../css/bootstrap.min.css?v=v3.3.7" media="all">
    <link rel="stylesheet" type="text/css" href="../css/font/iconfont.css?v=1.0.0" media="all">
    <link rel="stylesheet" type="text/css" href="../css/layui.css?v=1.0.9" media="all">
    <link rel="stylesheet" type="text/css" href="../css/main.css?v1.3.4" media="all">

</head>
<body>
    <div class="container-fluid larry-wrapper">
        <div class="row">
            <div class="col-xs-12 col-sm-12 col-md-12">
                <!--头部搜索-->
                <section class="panel panel-padding">
                    <form class="layui-form" action="/education/admin/operator">
                        <div class="layui-form">
                            <div class="layui-inline">
                                <select name="_query.mids">
                                    <option value="">权限类别</option>
                                    <option value="b991b11b6b2f4c08a6b8ed977d91b4b8">后台接口</option>
                                    <option value="1230ce23374a457aace0b5db41ede6e8">后台菜单</option>
                                    <option value="29a6341a292a40a69e5561e812bfd77e">客户端</option>
                                </select>
                            </div>
                            <div class="layui-inline">
                                <div class="layui-input-inline">
                                    <input class="layui-input" name="_query.keyword" placeholder="关键字">
                                </div>
                            </div>
                            <div class="layui-inline">
                                <input type="hidden" name="orderColunm" value="syslog" />
                                <select name="orderMode">
                                    <option value="">日志</option>
                                    <option value="asc">升序</option>
                                    <option value="desc">降序</option>
                                </select>
                            </div>
                            <div class="layui-inline">
                                <button lay-submit class="layui-btn" lay-filter="search">查找</button>
                            </div>
                        </div>
                    </form>
                </section>

                <!--列表-->
                <section class="panel panel-padding">
                    <div class="group-button">
                        <button class="layui-btn layui-btn-small modal-catch" beforeFun="beforeAdd"
                                data-params='{"content":".add-subcat","area":"600px, 500px", "title":"添加权限","data":"url=/education/admin/operator/save","end":"closeTab"}'>
                            <i class="iconfont">&#xe649;</i> 添加
                        </button>
                        <button class="layui-btn layui-btn-small layui-btn-danger ajax-all" data-name="ids"
                                data-params='{"url": "/education/admin/operator/delete"}'>
                            <i class="iconfont">&#xe626;</i> 删除
                        </button>
                    </div>
                    <div id="list" class="layui-form"></div>

                    <div class="text-right" id="page"></div>
                </section>
            </div>
        </div>
    </div>

    <div class="add-subcat">
        <form id="form1" class="layui-form"  action="/education/admin/operator/save">

            <input type="hidden" name="formtoken" value="0">
            <input type="hidden" name="ipblack" value="0">
            <input type="hidden" name="csrf" value="0">
            <input type="hidden" name="referer" value="0">
            <input type="hidden" name="method" value="0">
            <input type="hidden" name="enctype" value="0">
            <input type="hidden" name="ids">
<!--            <div class="layui-form-item">
                <label class="layui-form-label">模块</label>
                <div class="layui-input-inline">
                    &lt;!&ndash;<input type="text" name="moduleids" autocomplete="off" class="layui-input ">&ndash;&gt;
                    <select name="moduleids">
                        <option value="b991b11b6b2f4c08a6b8ed977d91b4b8">后台接口</option>
                        <option value="1230ce23374a457aace0b5db41ede6e8">后台菜单</option>
                        <option value="29a6341a292a40a69e5561e812bfd77e">客户端</option>
                    </select>
                </div>
            </div>-->

            <div class="layui-form-item">
                <label class="layui-form-label" style="width: 110px;">模块</label>
                <div class="layui-input-block">
                    <input type="radio" name="moduleids" title="后台接口" value="b991b11b6b2f4c08a6b8ed977d91b4b8" />
                    <input type="radio" name="moduleids" title="后台菜单" value="1230ce23374a457aace0b5db41ede6e8" />
                    <input type="radio" name="moduleids" title="客户端" value="29a6341a292a40a69e5561e812bfd77e" checked />
                </div>
            </div>

            <div class="layui-form-item">
                <label class="layui-form-label" style="width: 110px;">权限名称</label>
                <div class="layui-input-inline">
                    <input type="text" name="names" autocomplete="off" class="layui-input ">
                </div>
            </div>
            <div class="layui-form-item">
                <label class="layui-form-label" style="width: 110px;">路径</label>
                <div class="layui-input-block">
                    <input type="text" name="url" placeholder="" autocomplete="off" class="layui-input ">
                </div>
            </div>

            <div class="layui-form-item">
                <label class="layui-form-label" style="width: 110px;">是否分页</label>
                <div class="layui-input-block">
                    <input type="radio" name="splitpage" title="是" value="1" />
                    <input type="radio" name="splitpage" title="否" value="0" checked />
                </div>
            </div>

            <div class="layui-form-item">
                <label class="layui-form-label" style="width: 110px;">需要权限</label>
                <div class="layui-input-block">
                    <input type="radio" name="privilegess" title="是" value="1" />
                    <input type="radio" name="privilegess" title="否" value="0" checked />
                </div>
            </div>

            <div class="layui-form-item">
                <label class="layui-form-label" style="width: 110px;">记录日志</label>
                <div class="layui-input-block">
                    <input type="radio" name="syslog" title="是" value="1" />
                    <input type="radio" name="syslog" title="否" value="0" checked />
                </div>
            </div>

            <div class="layui-form-item">
                <label class="layui-form-label" style="width: 110px;">请求方式</label>
                <div class="layui-input-block">
                    <input type="radio" name="method" title="GET" value="0" />
                    <input type="radio" name="method" title="POST" value="2" checked />
                </div>
            </div>

            <div class="layui-form-item">
                <label class="layui-form-label" style="width: 110px;">批量</label>
                <div class="layui-input-block">
                    <input type="checkbox" name="batch" title="batch" value="1" />
                </div>
            </div>

            <div class="layui-form-item">
                <div class="layui-input-block">
                    <button class="layui-btn" jq-submit jq-filter="submit">立即提交</button>
                    <button type="reset" class="layui-btn layui-btn-primary">重置</button>
                </div>
            </div>
        </form>
    </div>
</body>
<!--#include file="operator-list.html"-->
<script src="../js/layui/layui.js"></script>
<script type="text/javascript" src="../js/lib/jquery-1.11.2.min.js"></script>
<script type="text/javascript" src="../js/lib/rest.js"></script>
<!--#include file="common/version.html"-->
<script>
    layui.use('user_list');

    function choiceDept(item){
        var $ = layui.jquery;
        $('input[name="departmentids"]').add($('input[name="_query.departmentids"]')).val(item.id);
        $('input[name="deptnames"]').add($('input[name="_query.departmentname"]')).val(item.name);
    }

    function beforeChoice(){
        var index = layer.open({
            type: 2,
            content: "dept-tree.html", "title": "选择部门", "area": ['500px', '600px'], "maxmin":"true"
        });
    }


    function beforeAdd(obj){
        $('.add-subcat input[name=ids]') && $('.add-subcat input[name=ids]').val('');
        $('.imgbox',$('#form1')) && $('.imgbox',$('#form1')).remove();
    }

    function beforeUpdate(ids){
        var index = layer.open({
            type: 1,
            title:'编辑',
            area:['600px','500px'],
            content: $('.add-subcat')
        });
        //layer.full(index);
        $('#form1').attr('action', '/education/admin/operator/update/'+ids);
        restGet('/education/admin/operator/view/' + ids, null, $('#form1'), function(rs){console.log(rs)
        })
    }

</script>

</html>